using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_MedicalMap : EntityTypeConfiguration<SO_Medical>
    {
        public SO_MedicalMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Patient__, t.Catalog, t.Specialty });

            // Properties
            this.Property(t => t.Patient__)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Patient_Name)
                .HasMaxLength(110);

            this.Property(t => t.Catalog)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Specialty)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Gender)
                .HasMaxLength(7);

            this.Property(t => t.Age)
                .HasMaxLength(10);

            this.Property(t => t.Address)
                .HasMaxLength(200);

            this.Property(t => t.note)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SO_Medical");
            this.Property(t => t.Patient__).HasColumnName("Patient_#");
            this.Property(t => t.Patient_Name).HasColumnName("Patient_Name");
            this.Property(t => t.Catalog).HasColumnName("Catalog");
            this.Property(t => t.Specialty).HasColumnName("Specialty");
            this.Property(t => t.Gender).HasColumnName("Gender");
            this.Property(t => t.Birth_Date).HasColumnName("Birth_Date");
            this.Property(t => t.Age).HasColumnName("Age");
            this.Property(t => t.Address).HasColumnName("Address");
            this.Property(t => t.note).HasColumnName("note");
        }
    }
}
